﻿(function () {

    layui.use(["layer", "jquery", "laydate"], function () {
        var layer = layui.layer;
        var $ = layui.jquery;
        var laydate = layui.laydate;

        $(document).ready(function () {
            $("#btnSearch").click(function () {
                $.ajax("/Fee/QueryByDate", {
                    method: "POST",
                    data: "date=" + $("#txtSearchDate").val(),
                    complete: function (jqXHR, textStatus) {

                    },
                    success: function (data, textStatus, jqXHR) {
                        var data2 = data.Data;
                        $("#QueryResult span.span2").eq(0).text(data2["OrderProfitFee"]);
                        $("#QueryResult span.span3").eq(0).text(data2["ShopManagerManageFee"]);
                        $("#QueryResult span.span4").eq(0).text(data2["BoundFee"]);
                        $("#QueryResult span.span5").eq(0).text(data2["ConsignmentSaleFee"]);
                        $("#QueryResult").show();
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        layer.msg(addStyle("系统错误，请联系管理员！"),
                            { icon: 2, time: 3 * 1000, offset: ["25%"], closeBtn: true });
                    }
                });
            });
        });

        laydate.render({
            elem: '#txtSearchDate',
            value: (new Date()),
            isInitValue: true,
            showBottom: false
        });

        function addStyle(str) {
            return '<span style="font-size: 16px;">' + str + '</span>';
        }
    });

})();